package com.pdemo.front.filter;

import java.security.Principal;
import java.util.Set;

public class ApplicationPrincipal implements Principal {
	
	private Long id;
	private Set<String> roles;
	private Boolean enabled;
	
	

	public ApplicationPrincipal() {
	}

	public ApplicationPrincipal(Long id, Boolean enabled, Set<String> roles) {
		super();
		this.id = id;
		this.enabled = enabled;
		this.roles = roles;
	}

	@Override
	public String getName() {
		return id.toString();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Set<String> getRoles() {
		return roles;
	}

	public void setRoles(Set<String> roles) {
		this.roles = roles;
	}

	public Boolean getEnabled() {
		return enabled;
	}
	
	public Boolean isUserInRole(String role){
		return roles.contains(role);
	}

	
	

}
